package com.candy.control;

import com.candy.bean.UserInfo;
import com.candy.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@RestController:该注解的作用相当于@Controller+ @ResponseBody的组合注解
//该注解作用于类上，则表示当前类的所有方法以json格式数据返回
@RestController
//也可以通过使用注解，处理跨域问题
//@CrossOrigin
public class LoginController {
    @Autowired
    LoginService loginService;

    @RequestMapping("/userlogin")
    public String logined(UserInfo userInfo){
        System.out.println("已接收到前台发送过来的请求"+userInfo);
        boolean ok= loginService.login(userInfo);
        if(ok){
            return "ok";
        }else {
            return "eg";
        }

    }




}
